package ar.edu.itba.it.poo.dd.backend

abstract class Bonus(val ammount: Int) extends Tile {
  require(ammount > 0)
  val name = getClass.getSimpleName

  private var _taken = false
  def taken = _taken

  def canEnter(player: Player) = true
  def onPlayerEnter(player: Player) = if (!taken) { pickup(player); _taken = true; }
  def pickup(player: Player)
}

class HealthBonus(a: Int) extends Bonus(a) {
  def pickup(player: Player) = player.heal(ammount)
}

class StrengthBonus(a: Int) extends Bonus(a) {
  def pickup(player: Player) = player.accumStrengthBonus(ammount)
}